<?php
/**
 * Author: Creatint <creatint@163.com> <http://creatint.yotaku.cn>
 */
namespace Page\Controller;
use Think\Controller;
class IndexController extends Controller{
	//首页
	public function index(){
		$Address = D('Address');
		$list = $Address->hselect();
//		trace($list,'list');
		$this->assign('show',$Address->show);
		$this->assign('list',$list);
		$this->display();
	}

	//详情页
	public function detail(){
		$id = I('get.id','','intval');

		$info = D('address')->find($id);

		/**jssdk***/
		$signPackage = $this->signPackage;
		$signPackage['title'] = "苗木通讯录：".$info['nickname'];
		$signPackage['link'] = 'http://'.C('DOMAIN').U('Index/detail',array('id'=>$info['id']));
		$signPackage['desc'] = "众里寻他千百度，苗友尽在通讯录，苗商驰骋天地间，买卖沟通更方便。";
		$signPackage['imgUrl'] = $info['headimgurl'];
		$this->assign('signPackage',$signPackage);
		trace($signPackage,'signPackage');
		/****/

		if(!empty($info['mobile'])) {
			$mobilearr = json_decode($info['mobile'],true);
			$info['mobilearr'] = $mobilearr;
			$this->assign('mobilearr',$mobilearr);
		}

		if(!empty($info['photo'])) {
			$info['photos'] = explode('|',$info['photo']);
		}
		$this->assign('photoarr',$info['photos']);

		$this->assign('info',$info);
		trace($info,'info');
		$this->display();
	}
}
